<script> $(document).ready(function() {
  $('div.layui-col-md3').theiaStickySidebar({
    additionalMarginTop: 65
  });
}); </script>
<footer>
<div class="layui-fluid">
  <div class="foot">
    <p>Powered by <a href="https://www.wendasns.com">Wendasns V{:config('wendasns.version')}</a> &copy; 2020-{:date('Y',time())}&nbsp;&nbsp;<a href="{:request()->domain()}">{:configure('website.webName')}</a></p>
    {if configure('website.icpInfo')}<p><a rel="nofollow" href="http://beian.miit.gov.cn/" target="_blank">{:configure('website.icpInfo')}</a></p>{/if}
  </div>
</div>
{:configure('website.statisCode')}
</footer>
<div class="layui-hide-sm layui-show-xs-block">
  <bottom-nav>
    <a href="/">
        <i class="layui-icon layui-icon-home" style="font-size: 20px;"></i>
        <span>首页</span>
      </a>
      <a href="{:url('wendasns/question/index',[],false)}">
        <i class="layui-icon layui-icon-help" style="font-size: 20px;"></i>
        <span>问题</span>
      </a>
      <a href="javascript:;" id="postment">
        <i class="layui-icon layui-icon-release" style="font-size: 20px;"></i>
        <span>发布</span>
      </a>
      <a href="{:url('wendasns/article/index',[],false)}">
        <i class="layui-icon layui-icon-read" style="font-size: 20px;"></i>
        <span>文章</span>
      </a>
    <a href="{:url('wendasns/topic/index',[],false)}">
        <i class="layui-icon layui-icon-tabs" style="font-size: 20px;"></i>
        <span>话题</span>
      </a>
</bottom-nav>
 </div>

<!--分享-->
<script id="share" type="text/html">
<div class="layui-row">
    <p><a href="{:url('wendasns/common/share',['type'=>'weibo'])}?uri={{encodeURIComponent(d.url)}}&title={{d.title}}" style="color: #fff;font-size: 14px;display: block;padding: 5px;" target="_blank"><i class="layui-icon layui-icon-login-weibo"></i> 新浪微博</a></p>
    <p><a href="{:url('wendasns/common/share',['type'=>'qzone'])}?uri={{encodeURIComponent(d.url)}}&title={{d.title}}" style="color: #fff;font-size: 14px;display: block;padding: 5px;" target="_blank"><i class="layui-icon layui-icon-login-qq"></i> QQ空间</a></p>
    <p style="color: #fff;font-size: 14px;display: block;padding: 5px;"><i class="layui-icon layui-icon-login-wechat"></i> 微信扫一扫</p>
    <p style="background-color: #FFFFFF;padding: 3px;"><img class="ShareMenu-qrCode" src="{:url('wendasns/common/qrcode')}?url={{encodeURIComponent(d.url)}}" alt="微信二维码" width="94"></p>
</div>
</script>

<script src="/static/wendasns/layui.js"></script>
<script>
function wds(n,e){
	layui.wendasns[n].call(this,e);
}
layui.config({
  base: '/static/wendasns/lay/modules/'
  ,version: new Date().getTime()
}).use(['wendasns','dialog','comment']);
</script>
<script>
layui.util.fixbar({
    bar1: false
    ,bgcolor: '#d2d2d2'
   	,css: {bottom: 60}
    ,click: function(type){
    }
  });
</script>

<script>
;!function(){
    
    var $ = layui.$
    ,form = layui.form
    ,upload = layui.upload
    ,router = layui.router()
    ,dropdown = layui.dropdown
    ,element = layui.element;
    form.render();

    var authstatus = {if isset($mousinfo.status)}{$mousinfo.status}{else}''{/if};
     if(authstatus ==1){
      (event.returnValue = false);
     }

     var realstatus = {if isset($real.status)}{$real.status}{else}''{/if};
     if(realstatus ==1){
      (event.returnValue = false);
     }



  dropdown.render({
    elem: '#postment'
    ,align: 'center'
    ,data: [{
      title: '问题'
      ,id: 100
      ,href: '{:url('wendasns/question/post')}'
    },{
      title: '文章'
      ,id: 101
      ,href: '{:url('wendasns/article/post')}'
    }]
  });
  
     //类型切换
     form.on('radio(onRadioValue)', function(data){
    var val = data.value;
      switch(val){
        case '3':
          $("#vertify_form .change_name").html("{$gereninfo['name']}");
          $("#vertify_form .change_idcode").html("{$gereninfo['idcode']}");
          break;
        case '2':
          $("#vertify_form .change_name").html("{$qiyeinfo['name']}");
          $("#vertify_form .change_idcode").html("{$qiyeinfo['idcode']}");
          break;
        }
    });

    //提交表单
    form.on('submit(J_mous_up)', function(data){
        var field = data.field; //获取提交的字段   
        $.ajax({
            url: '{:url('wendasns/user/auths')}',
            type: 'post',
            data: field,
            dataType:'json',
            success: function(res){
                var icon = res.code==0?1:2;
                layer.msg(res.msg,{icon:icon,time:2000},function(){
                    if(res.code==0){
                        parent.location.reload();
                    }         
                });
            }
        });
    });

    //图片上传
    var uploadInst = upload.render({
      elem: '.J_mous_img'
      ,done: function(res,index,upload){
        layer.msg(res.msg);
        var aa = $(this.item).text();
        if(aa == '上传身份照正面照片'){
          $('.id_card_image').val(res.data.src);
          $('.imgtags').attr('src', res.data.src);
        }else if(aa == '上传营业执照或身份证照片'){
          $('.license_image').val(res.data.src);
          $('.licenseimg').attr('src', res.data.src);
		}else if(aa == '上传封面图片'){
          $('.id_card_image').val(res.data.src);
          $('.imgtags').attr('src', res.data.src);
        }else{
          $('.skill_image').val(res.data.src);
          $('.imgtag').attr('src', res.data.src);
        }
        
      }
      ,error: function(){
        layer.msg('上传失败');
      }
    });

    // 城市
  form.on('select(province_select)', function(data){
    var cate_id = data.value;
    console.log(cate_id);
    $.get("{:url('wendasns/user/city')}",{cate_id:cate_id},function(res){
      
          if(cate_id == 0){
            $(".city_select").empty();$('.city_select').append('<option value="">请选择</option>');
            $(".yu").hide();
          }else{
            $(".city_select").empty();
            // $('#zcySelect').append('<option value="">请选择城市</option>');   
            $.each(res.data,function(){
              // var fid = {if isset($user.cityid)}{$user.cityid}{else}''{/if};
              // var abc = '';
              // if(this.id == fid){
              //   abc = 'selected';
              // }
              var str = '<option value="'+ this.id +'">'+ this.area_name +'</option>';
              $(".city_select").append(str);
              $(".yu").show();

            });
            form.render('select');
          }       
        
    },'json');

  });

    //个人中心的提交表单
    form.on('submit(J_mous_home)', function(data){
        var field = data.field; //获取提交的字段   
        $.ajax({
            url: '{:url('wendasns/user/editinfo')}',
            type: 'post',
            data: field,
            dataType:'json',
            success: function(res){
                var icon = res.code==0?1:2;
                layer.msg(res.msg,{icon:icon,time:2000},function(){
                    if(res.code==0){
                        parent.location.reload();
                    }         
                });
            }
        });
    });


  /* Hash地址的定位 */
  var layid = router.hash.replace(/^#mous=/, '');
  layid && element.tabChange('mous_atb', layid);
  
  element.on('tab(mous_atb)', function(elem){
    location.hash = '/'+ layui.router().path.join('/') + '#mous=' + $(this).attr('lay-id');
  });


}();
</script>